<script type="text/javascript">
	$(document).ready(function() {
		$("#edit_release, #edit_archive").datepicker({
			dateFormat: 'yy-mm-dd',
			changeYear: true,
			changeMonth: true,
			onSelect: function(dateText, inst) {
									
			}
		});
	});
</script>
<form class="form-horizontal" method='post' action='/documents/edit/<?php echo $id;?>' enctype='multipart/form-data'>
    <div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h3 id="myModalLabel">Edit Document</h3>
	</div>
	<br />
	<div class="control-group">
		<label class="control-label" for="file">File</label>
		<div class="controls">
			<?php echo $this->Form->file('Document.files');?>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="name">Name</label>
		<div class="controls">
			<input type="hidden" id="hidden_id" name="data[Document][id]" value="<?php echo $document['Document']['id'];?>">
			<input type="text" id="edit_name" placeholder="Name" name="data[Document][name]" value="<?php echo $document['Document']['name'];?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="serial">Serial</label>
		<div class="controls">
			<input type="text" id="edit_serial" placeholder="Serial" name="data[Document][serial]" value="<?php echo $document['Document']['serial'];?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="note">Note</label>
		<div class="controls">
			<textarea rows="3" id="edit_note" placeholder="Note" name="data[Document][note]"><?php echo $document['Document']['note'];?></textarea>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="owner">Owner</label>
		<div class="controls">
			<input type="text" id="edit_owner" placeholder="Owner" name="data[Document][owner]" value="<?php echo $document['Document']['owner'];?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="release">Release Date</label>
		<div class="controls">
			<input type="text" id="edit_release" placeholder="Release Date" name="data[Document][release_date]" value="<?php echo date('Y-m-d',strtotime($document['Document']['release_date']));?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="release">Archive Date</label>
		<div class="controls">
			<input type="text" id="edit_archive" placeholder="Archive Date" name="data[Document][archive_date]" value="<?php echo date('Y-m-d',strtotime($document['Document']['archive_date']));?>">
		</div>
	</div>
	<div class="modal-footer">
		<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
		<button class="btn btn-primary" type='submit'>Save</button>
	</div>
</form>
